import http from './request.js';

// 用户信息
export const login = data => http.post('/users/login', data);
export const register = data => http.formUrlEncoded('/users/register', data);
export const logout = params => http.get('/users/logout', params);
export const getUserInfo = params => http.get('/users/info', params);
export const updateUserInfo = data => http.post('/users/update', data);
export const resetPwd = data => http.post('/users/rpwd', data);

// 商品信息
export const getGoodsList = params => http.get('/goods/list', params);
export const getGoodsDetail = id => http.get('/goods/item/' + id);
export const getGoodsCategory = () => http.get('/goods/category');

// 购物车
export const getCartList = params => http.get('/cart/list', params);
export const addToCart = data => http.post('/cart/add', data);
export const delCart = params => http.get('/cart/remove', params);
export const delCartSelect = params => http.get('/cart/remove/select', params);
export const clearCart = params => http.get('/cart/clear', params);
export const cartSelect = data => http.post('/cart/select', data);
export const cartSelectAll = data => http.post('/cart/select/all', data);
export const changeCartNum = data => http.post('/cart/number', data);
export const cartPay = data => http.post('/cart/pay', data);